package com.design.pattern.structural.facade;

/**
 * 认认真真写写
 * User: RenQiQiqng
 * Date: 2019/3/10-Time: 16:26
 * Description:
 * 积分兑换服务
 */
public class GiftExchangeGift {

    //模拟Spring注入
    private QualifyService qualifyService = new QualifyService();
    private PointsPaymentService pointsPaymentService = new PointsPaymentService();
    private ShippingService shippingService = new ShippingService();

    public void gitExchange(PointGift pointGift) {
        if (qualifyService.isAvaliable(pointGift)) {
            if (pointsPaymentService.pay(pointGift)) {
                //如果支付积分成功
                String shippingOrderNo = shippingService.shipGift(pointGift);
                System.out.println("物流系统下单成功,订单号是:" + shippingOrderNo);
            }
        }
        //资格校验
        //支付积分成功
        //物流系统
    }
}
